// 1、引入
import VueRouter from "vue-router";
import Vue from "vue";

// 2、、注册全局组件
Vue.use(VueRouter);

// 3、配置路由规则
const routes = [
    {
        path: "/",
        redirect: "/login"
    },
    {
        path: "/login",
        component: ()=>import("@/views/login.vue")
    },
    {
        path: "/layout",
        component:()=>import("@/views/layout.vue"),
        redirect: "/layout/index",
        children: [
            {
                path: "index",
                component: ()=>import("@/views/index.vue")
            },{
                path: "articleList",
                component: ()=>import("@/views/articleList.vue")
            },{
                path: "articleAdd",
                component: ()=>import("@/views/articleAdd.vue")
            }
        ]
    }
]

// 4、生成路由对象
const router = new VueRouter({
    routes
})

// 5、导出
export default router
